package day08.thread02.stopThread;

/**
 * <>
 * <详细描述>
 *
 * @Author WANG.SONG.
 * @Date 2019/3/3 0003 22:10
 * @see
 */
public class ExceptionThread extends Thread {

    @Override
    public void run() {
        super.run();
        try {
            for (int i = 0 ; i < 5000000 ; i++){
                if (this.isInterrupted()){
                    System.out.println("退出！！！！！");
                   throw new InterruptedException("线程interrupt Ex!");
                }
                System.out.println("i = "+i);
            }
            System.out.println("线程停止我还是继续执行");
        } catch (InterruptedException e) {
            System.out.println("线程打断抛异常");
            e.printStackTrace();
        }

    }
}
